<template>
  <div class="swiper-wrap">
    <swiper :options="swiperOption" ref="mySwiper">
      <swiper-slide v-for="(item, index) of picDatas" :pic="item" :key="index">
        <img class="swiper-img" :src="item" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper';
import 'swiper/dist/css/swiper.css';

export default {
  name: 'DetailSwiper',
  components: {
    Swiper,
    SwiperSlide,
  },
  props: {
    picDatas: Array,
  },
  data() {
    return {
      swiperOption: {
        initialSlide: 1,
        pagination: {
          el: '.swiper-pagination',
        },
      },
    };
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper;
    },
  },
  mounted() {
    // console.log(this.swiper)
  },
};
</script>

<style lang="scss" scoped>
@import '@/assets/styles/variables.scss';

.swiper-wrap >>> .swiper-pagination-bullet-active {
  background-color: $defaultGreen;
}

.swiper-slide {
  height: 2rem;
}

.swiper-img {
  width: 100%;
  height: 100%;
}
</style>
